using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using bitzhuwei.Compiler;

namespace bitzhuwei.AnsiCFormat {
    /// <summary>
    /// Correspond to the Vn node iteration_statement in the grammar(AnsiC).
    /// </summary>
    internal abstract partial class Vniteration_statement : Vnstatement {
        // [194]=iteration_statement : 'while' '(' expression ')' statement ;
        // [195]=iteration_statement : 'do' statement 'while' '(' expression ')' ';' ;
        // [196]=iteration_statement : 'for' '(' expression_statement expression_statement ')' statement ;
        // [197]=iteration_statement : 'for' '(' expression_statement expression_statement expression ')' statement ;

        /// <summary>
        /// [194]=iteration_statement : 'while' '(' expression ')' statement ;
        /// </summary>
        public class while_ : Vniteration_statement {

            /// <summary>
            /// [194]=iteration_statement : 'while' '(' expression ')' statement ;
            /// </summary>
            /// <param name="r4"></param>
            /// <param name="r3"></param>
            /// <param name="r2"></param>
            /// <param name="r1"></param>
            /// <param name="r0"></param>
            public while_(Token r4, Token r3, Vnexpression r2, Token r1, Vnstatement r0) {
                this.r4 = r4;
                this.r3 = r3;
                this.r2 = r2;
                this.r1 = r1;
                this.r0 = r0;
                this._scope = new TokenRange(r4, r0);
            }

            private readonly Token r4;
            private readonly Token r3;
            private readonly Vnexpression r2;
            private readonly Token r1;
            private readonly Vnstatement r0;
            private TokenRange _scope;

            public override TokenRange Scope => _scope;

            public override void Format(TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }

            public override void FullFormat(BlankConfig preConfig, TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }

            public override IEnumerable<string> YieldTokens(TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// [195]=iteration_statement : 'do' statement 'while' '(' expression ')' ';' ;
        /// </summary>
        public class do_ : Vniteration_statement {

            /// <summary>
            /// [195]=iteration_statement : 'do' statement 'while' '(' expression ')' ';' ;
            /// </summary>
            /// <param name="r6"></param>
            /// <param name="r5"></param>
            /// <param name="r4"></param>
            /// <param name="r3"></param>
            /// <param name="r2"></param>
            /// <param name="r1"></param>
            /// <param name="r0"></param>
            public do_(Token r6, Vnstatement r5, Token r4, Token r3, Vnexpression r2, Token r1, Token r0) {
                this.r6 = r6;
                this.r5 = r5;
                this.r4 = r4;
                this.r3 = r3;
                this.r2 = r2;
                this.r1 = r1;
                this.r0 = r0;
                this._scope = new TokenRange(r6, r0);
            }


            private readonly Token r6;
            private readonly Vnstatement r5;
            private readonly Token r4;
            private readonly Token r3;
            private readonly Vnexpression r2;
            private readonly Token r1;
            private readonly Token r0;
            private TokenRange _scope;

            public override TokenRange Scope => _scope;

            public override void Format(TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }

            public override void FullFormat(BlankConfig preConfig, TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }

            public override IEnumerable<string> YieldTokens(TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }
        }

        public class for_ : Vniteration_statement {

            /// <summary>
            /// [196]=iteration_statement : 'for' '(' expression_statement expression_statement ')' statement ;
            /// [197]=iteration_statement : 'for' '(' expression_statement expression_statement expression ')' statement ;
            /// </summary>
            /// <param name="r6"></param>
            /// <param name="r5"></param>
            /// <param name="r4"></param>
            /// <param name="r3"></param>
            /// <param name="r2"></param>
            /// <param name="r1"></param>
            /// <param name="r0"></param>
            public for_(Token r6, Token r5, Vnexpression_statement r4, Vnexpression_statement r3, Vnexpression? r2, Token r1, Vnstatement r0) {
                this.r6 = r6;
                this.r5 = r5;
                this.r4 = r4;
                this.r3 = r3;
                this.r2 = r2;
                this.r1 = r1;
                this.r0 = r0;
                this._scope = new TokenRange(r6, r0);
            }


            private readonly Token r6;
            private readonly Token r5;
            private readonly Vnexpression_statement r4;
            private readonly Vnexpression_statement r3;
            private readonly Vnexpression? r2;
            private readonly Token r1;
            private readonly Vnstatement r0;
            private TokenRange _scope;

            public override TokenRange Scope => _scope;

            public override void Format(TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }

            public override void FullFormat(BlankConfig preConfig, TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }

            public override IEnumerable<string> YieldTokens(TextWriter writer, FormatContext context) {
                throw new NotImplementedException();
            }
        }

    }
}
